package com.emp.entity;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;

public class Test {
	
	public static void main(String[] args) {
		
		
		Configuration cfg=new Configuration();
		cfg.configure();
		SessionFactory sf=cfg.buildSessionFactory();
		Session ses=sf.openSession();
		Transaction tx=ses.beginTransaction();
		
//		Emp e=new Emp();
		
		
		PEmplyoee p=new PEmplyoee();
		p.setDepartment("Java");
		p.setDesg("softeng");
		p.setName("Vijay");
		p.setEmpId(14);
		TEmplyoee t=new TEmplyoee();
		
		t.setContractName("javaContract");
		t.setEmpId(13);
		t.setName("yadav");
		t.setWorkingdays((short)60);
		
		ses.save(p);
		ses.save(t);
		
		tx.commit();
		
		System.out.println("Objects saved Successsfully.......");
	}

}
